<!DOCTYPE HTML>
<html>
<head>
    <title>Getting Started: Serving Web Content</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="layui/css/layui.css" media="all">
</head>
<body>

<form class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">目标</label>
        <div class="layui-input" style="height: 600px;weight:400px">
            <textarea type="text" name="pdTarget" autocomplete="off" placeholder="请输入目标" class="layui-input" style="height: 600px;weight:400px">
[
  {"bossNo": 21,
    "totalBlood": 600},
  {"bossNo": 22,
    "totalBlood": 800},
  {"bossNo": 23,
    "totalBlood": 1000},
  {"bossNo": 24,
    "totalBlood": 1200},
  {"bossNo": 25,
    "totalBlood": 2000},{"bossNo": 21,
    "totalBlood": 600},
  {"bossNo": 22,
    "totalBlood": 800},
  {"bossNo": 23,
    "totalBlood": 1000},
  {"bossNo": 24,
    "totalBlood": 1200},
  {"bossNo": 25,
    "totalBlood": 2000},{"bossNo": 21,
    "totalBlood": 600},
  {"bossNo": 22,
    "totalBlood": 800},
  {"bossNo": 23,
    "totalBlood": 1000},
  {"bossNo": 24,
    "totalBlood": 1200},
  {"bossNo": 25,
    "totalBlood": 2000},
  {"bossNo": 21,
    "totalBlood": 600}
]</textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input">
            <button class="layui-btn" id="calPossible">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script src="layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use(['form','jquery'], function(){
        var form = layui.form,
            $ = layui.jquery
        //监听提交
        $('#calPossible').on('click', function(){
            var param = JSON.parse($("textarea[name='pdTarget']").val())
            $.ajax({
                url:"/pd/6.calResultV2",
                type: "POST",
                datType: "JSON",
                contentType: "application/json",
                data:JSON.stringify(param),
                headers:{ token: window.sessionStorage.getItem('token') },
                success:function(result){
                    if (result.code == 0) {
                        parent.location.reload()
                    }else{
                        layer.alert("异常错误:"+result.message)
                    }
                },
                error: function () {
                    layer.alert("请求失败，请联系管理员")
                }
            })
            return false;
        });
    });
</script>


</body>
</html>
